package com.xoa.controller.certificate;


import com.xoa.model.certificate.CrmCertificateWithBLOBs;
import com.xoa.service.certificate.CrmCertificateService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/crmCertificate")
public class CrmCertificateConteroller {
    @Autowired
    private CrmCertificateService crmCertificateService;

    /**
     *
     * @作者 李卫卫
     * @创建日期 9:05 2020/8/7
     * @类介绍 添加资源证书
     * @参数  certNo编号 certName名称 certStartTime起止时间 certEndTime 截止时间
     * @return limsJson
     */

    @RequestMapping("/insetCertificate")
    @ResponseBody
    public ToJson insetCertificate (HttpServletRequest request, @RequestParam("json") String json){
        return crmCertificateService.insetCertificate(request,json);
    }

    /**
     *
     * @作者 李卫卫
     * @创建日期 14:18 2020/8/7
     * @类介绍 删除资源证书
     * @参数
     * @return limsJson
     */
    @RequestMapping("/deleteCertificate")
    @ResponseBody
    public ToJson deleteCertificate(@RequestParam("certId") Integer certId){
        return crmCertificateService.deleteCertificate(certId);
    }

    /**
     *
     * @作者 李卫卫
     * @创建日期 14:46 2020/8/10
     * @类介绍 模糊查询 以及页面展示数据
     * @参数
     * @return limsJson
     */
    @RequestMapping("/selectByCertificates")
    @ResponseBody
    public ToJson selectByCertificates(HttpServletRequest request , CrmCertificateWithBLOBs crmCertificateWithBLOBs , Integer page , Integer limit){
        return crmCertificateService.selectByCertificates(request , crmCertificateWithBLOBs , page , limit);
    }


    /**
     *
     * @作者 李卫卫
     * @创建日期 22:11 2020/8/10
     * @类介绍 编辑资源证书
     * @参数
     * @return limsJson
     */
    @RequestMapping("/updateByPrimaryKey")
    @ResponseBody
    public ToJson updateByPrimaryKey (CrmCertificateWithBLOBs crmCertificate){
        return crmCertificateService.updateByPrimaryKey(crmCertificate);
    }

}
